package com.ericsson.mhealth.server.config.providers;

import java.util.Date;

import com.ericsson.mhealth.server.helper.DateTimeSerializer;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.inject.Inject;
import com.google.inject.Provider;

public class GsonProvider implements Provider<Gson> {
	
	private GsonBuilder gsonBuilder;
	
	@Inject
	public GsonProvider(GsonBuilder gsonBuilder) {
		this.gsonBuilder = gsonBuilder;
		this.gsonBuilder.registerTypeAdapter(Date.class, new DateTimeSerializer());
	}

	@Override
	public Gson get() {
		return gsonBuilder.create();
	}

}
